import os
import json
from conf.settings import STUDENTS_JSON_PATH
from loguru import logger

def loads_students_json():
    students = {}
    if os.path.exists(STUDENTS_JSON_PATH):
        with open(STUDENTS_JSON_PATH, "r", encoding="utf-8") as f:
            students = json.load(f)
        logger.info(f"{STUDENTS_JSON_PATH}加载成功！")
    return students

def save_students(customers):
    with open(STUDENTS_JSON_PATH, "w", encoding="utf-8") as f:
        # json.dumps()
        json.dump(customers, f)